<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:output method="xml" />
    
   <!-- <xsl:param name="currentManifest">
        <xsl:comment>getting current manifest via param </xsl:comment>
        <xsl:variable name="lang" select="//assessmentItem/@lang"/>
        <xsl:variable name="module" select="//assessmentItem/@module"/>
        <xsl:choose>
            <xsl:when test="starts-with($module,'m10')">
                    <xsl:value-of
                        select="document('manifests/manifest10.xml')//resources[@identifier=$lang]"/>
<!-\-                        select="document('manifests/manifest10.xml')//resources[@identifier=$lang]"/>-\->
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m1')">
                <xsl:value-of
                        select="document('manifests/manifest1.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m2')">
                <xsl:value-of
                        select="document('manifests/manifest2.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m3')">
                <xsl:value-of
                        select="document('manifests/manifest3.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m4')">
                <xsl:value-of
                        select="document('manifests/manifest4.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m5')">
            <xsl:value-of
                        select="document('manifests/manifest5.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m6')">
                <xsl:value-of
                        select="document('manifests/manifest6.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m7')">
                <xsl:value-of
                        select="document('manifests/manifest7.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m8')">
                <xsl:value-of
                        select="document('manifests/manifest8.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m9')">
                <xsl:value-of
                        select="document('manifests/manifest9.xml')//resources[@identifier=$lang]"/>
                
            </xsl:when>
            
            <xsl:otherwise>
                error : module not identified
            </xsl:otherwise>
        </xsl:choose>
    </xsl:param>
    -->
    
    <xsl:template name="print-manifest">
        <xsl:param name="lang" select="//assessmentItem/@lang"/>
        <xsl:param name="module" select="//assessmentItem/@module"/>
        <xsl:choose>
            <xsl:when test="starts-with($module,'m10')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest10.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m1')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest1.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m2')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest2.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m3')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest3.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m4')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest4.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m5')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest5.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m6')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest6.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m7')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest7.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m8')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest8.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:when test="starts-with($module,'m9')">
                <manifest>
                    <xsl:copy-of
                        select="document('manifests/manifest9.xml')//resources[@identifier=$lang]"/>
                </manifest>
            </xsl:when>
            
            <xsl:otherwise>
                error : module not identified
            </xsl:otherwise>
        </xsl:choose>
        
    </xsl:template>
    
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    
    
</xsl:stylesheet>